<!DOCTYPE html>
<html>

<%@page import="dao.DatabaseOperations"%>
<%@page import="models.CourseBean"%>
<%@page import="dao.ConnectionManager"%>
<%@page import="java.sql.Connection"%>
<%@page import="java.sql.Date"%>
<%@page import="java.sql.SQLException"%>
<%@page import="java.sql.ResultSet"%>
<%@page import="java.sql.Statement"%>
<%@page import="java.util.ArrayList"%>
<%
//there will be changes in this part
CourseBean course = (CourseBean)request.getAttribute("course");
System.out.println("CourseID:");
System.out.println(course.getCourseID());
%>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title><%=course.getCourseName()%></title>

<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"></meta>
<meta content="width=device-width, initial-scale=1.0" name="viewport"></meta>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"></meta>
<meta content="IE=edge" http-equiv="X-UA-Compatible"></meta>
<link href="css/reset.css" rel="stylesheet" type="text/css" />
<link href="css/bootstrap.min.css" rel="stylesheet" type="text/css" />
<link href="css/stil.css" rel="stylesheet" type="text/css" />

</head>

<body>

<div class = "navbar navbar-inverse navbar-static-top"> 
		<div class = "container">
			<a href = "#" class = "navbar-brand"> MOOCers </a>
			<button class = "navbar-toggle" data-toggle = "collapse" data-target = ".navHeaderCollapse" > 
				<span class = "icon-bar"> </span>
				<span class = "icon-bar"> </span>
				<span class = "icon-bar"> </span>
			</button>
				
			<div class = "collapse navbar-collapse navHeaderCollapse">
			
				<ul class = "nav navbar-nav navbar-right"> 
					<li class = "active" > <a href = "#"> Home </a> </li>
					<li class = "dropdown" > 
						<a href = "#" class = "dropdown-toggle" data-toggle = "dropdown">Courses<b class = "caret"> </b> </a>
						<ul class = "dropdown-menu">
							<li> <a href = "#"> Add Course </a> </li>
							<li> <a href = "#"> Search Course </a> </li>
						</ul>
					<li> <a href = "#"> Instructors </a></li>
					<li> <a href = "#"> Forum </a> </li>
					<li> <a href = "./logout.jsp"> Logout </a> </li>
				</ul>
			</div>
		</div>
	</div>
	
	

	<div class = "container" >
		<div class = "row" >
			<label for="CourseID" class="col-sm-2 control-label" style= "margin-left: 90px">CourseID</label>
		</div>
		<div class="row-fluid" style = "width:750px; margin-left: 50px">
			<div class="span4 well" >
				<div id= "CourseIDContent" > 
					<% out.println(course.getCourseID());%>
				</div>
			</div>
			
			
			<div class = "row">
				<label for="Objective" class="col-sm-2 control-label" style= "margin-left: 40px">Objective</label>
			</div>
			<div class="span4 well" >
				<div id= "ObjectiveContent" > 
					<% out.println(course.getCourseObjective());%>
				</div>
				<div class="form-group">
					<div class="span4">
						<form action="ChangeCourseObjective" method ="GET">
							<textarea rows="3" style =" width: 515px; margin-left: 10px: " placeholder="Course Objective"><%out.println(course.getCourseObjective());%></textarea>
					
							<P><button type="submit" id="EditObjective" class="btn btn-primary" style="margin-top:5px">Edit Objective</button>
							<input type="hidden" name="courseID" value=<%out.println(course.getCourseID());%> />
						</form>
					</div>
				</div>
			</div>
			
			
			<div class = "row">
				<label for="DateAdded" class="col-sm-2 control-label" style= "margin-left: 40px">Date Added</label>
			</div>
			<div class="span4 well" >
				<div id= "DateAddedContent" > 
					<% out.println(course.getDate());%> 
				</div>
			</div>
			
			
			<div class = "row">
				<label for="Language" class="col-sm-2 control-label" style= "margin-left: 40px">Language</label>
			</div>
			<div class="span4 well" >
				<div id= "LanguageContent" > 
					<% out.println(course.getLanguage());%>
				</div>
				<div class="form-group">
					<div class="span4">
						<form action="ChangeCourseLanguage" method ="GET">
							<textarea rows="3" style =" width: 515px; margin-left: 10px: " placeholder="Language"> <%out.println(course.getLanguage());%></textarea>
							<P><button type="submit" id="EditLanguage" class="btn btn-primary" style="margin-top:5px">Edit Language</button>
							<input type="hidden" name="courseID" value=<%out.println(course.getCourseID());%> />
					</div>
				</div>
			</div>
			
			
			<div class = "row">
				<label for="ForumURL" class="col-sm-2 control-label" style= "margin-left: 40px">Forum URL</label>
			</div>
			<div class="span4 well" >
				<div id= "ForumURLContent" > 
					<% out.println(course.getForumURL());%>
				</div>
				<div class="form-group">
					<div class="span4">
						<form action="ChangeCourseForumURL" method ="GET">
							<textarea rows="3" style =" width: 515px; margin-left: 10px: " placeholder="Forum URL"> <%out.println(course.getForumURL());%></textarea>
							<P><button type="submit" id="EditForumURL" class="btn btn-primary" style="margin-top:5px">Edit Forum URL</button>
							<input type="hidden" name="courseID" value=<%out.println(course.getCourseID());%> />
							</div>
				</div>
			</div>
			
							
			<div class = "row">
				<label for="Rates" class="col-sm-2 control-label" style= "margin-left: 40px">Rates</label>
			</div>
			<div class = "row-fluid">
				<div class = "span col-md-5 well">
					<% out.println(course.getRate1());%>,
					<% out.println(course.getRate2());%>, 
					<% out.println(course.getRate3());%>, 
					<% out.println(course.getRate4());%>, 
					<% out.println(course.getRate5());%> 	
				</div>
										
				<div class = "span sidebar col-md-5 well" style = "margin-left: 50px">
					<form  name="actionForm" action="CourseRate" method ="GET" >
						<div id="content" >
							<table border="0" style = "margin-left:40px">
								<tr>
									<td><label for='rate1' >Clarity of Topics:</label></td>
									<td><input type='text' name='rate1' id='rate1' style = "width: 40px" placeholder="./5"  /></td>
								</tr>
								<tr>
									<td><label for='rate2' >Clarity of Examples:</label></td>
									<td><input type='text' name='rate2' id='rate2' style = "width: 40px" placeholder="./5"   /></td>
								</tr>
								<tr>
									<td><label for='rate3' >Achievements of Objectives:</label></td>
									<td><input type='text' name='rate3' id='rate3' style = "width: 40px" placeholder="./5"    /></td>
								</tr>
								<tr>
									<td><label for='rate4' >Availability of Material:</label></td>
									<td><input type='text' name='rate4' id='rate4' style = "width: 40px" placeholder="./5"   /></td>
								</tr>
								<tr>
									<td><label for='rate5' >Pace of the Course:</label></td>
									<td><input type='text' name='rate5' id='rate15' style = "width: 40px" placeholder="./5"   /></td>
								</tr>
							</table>
							<button type="submit" id="RateCourse" class="btn btn-primary" style = "margin-left: 40px" >Rate Course</button>
							<input type="hidden" name="courseID" value=<%out.println(course.getCourseID());%> />
						</div>
					</form>								
				</div>
			</div>
			
			
			<div class = "row">
				<label for="AvgRate" class="col-sm-2 control-label" style= "margin-left: 40px">Average Rate</label>
			</div>
			<div class="span4 well" >
				<div id= "AvgRateContent" > 
					<% out.println((double)(course.getRate1() + course.getRate2() + course.getRate3() +
course.getRate4() + course.getRate5())/5
);%>
				</div>
			</div>
			
			
			<div class = "row">
				<label for="AvgRate" class="col-sm-2 control-label" style= "margin-left: 40px">Average Rate</label>
			</div>
			<div class="span4 well" >
				<div id= "AvgRateContent" > 
					<% out.println((double)(course.getRate1() + course.getRate2() + course.getRate3() +
course.getRate4() + course.getRate5())/5
);%>
				</div>
			</div>
			
			
			<div class = "row">
				<label for="RateCount" class="col-sm-2 control-label" style= "margin-left: 40px">Rate Count</label>
			</div>
			<div class="span4 well" >
				<div id= "RateCountContent" > 
					<% out.println(course.getRateCount());%>
				</div>
			</div>

			
			<div class = "row">
				<label for="Comments" class="col-sm-2 control-label" style= "margin-left: 40px">Comments</label>
			</div>
			<div class="span4 well" >
				<div id= "CommentContent" > 
					<% ArrayList<ArrayList<String>> comments = DatabaseOperations.getComments(course.getCourseID());
int count = 0;
for (int i=0; i<comments.size(); i++)
{
	ArrayList<String> temp = comments.get(i);
	out.println("<b>" + temp.get(0) + "</b>" +
			": " + temp.get(1) + ", <i>" +  temp.get(2) + " likes.</i>");
				out.println("<br>");
	
}%> 
				</div>
				<div class="form-group">
					<div class="span4">
						<form action="CourseMakeComment" method ="GET">
							<textarea rows="3" style =" width: 515px; margin-left: 10px; margin-top:15px " placeholder="Post a Comment"></textarea>
							<P><button type="submit" id="MakeComment" class="btn btn-primary" style="margin-top:5px">Comment</button>
							<input type="hidden" name="courseID" value=<%out.println(course.getCourseID());%> />
							<input type="hidden" name="studentID" value=<%out.println(session.getAttribute("currentName"));%> />
						</form>
					</div>
				</div>
			</div>
			
			
			<div class = "row">
				<label for="About" class="col-sm-2 control-label" style= "margin-left: 40px">About</label>
			</div>
			<div class="span4 well" >
				<div id= "AboutContent" > 
					<%
	System.out.println();
	ArrayList<String> about = DatabaseOperations.getCourseAbout(course.getCourseID());
for (int i=0; i<about.size(); i++)
{
	out.println(about.get(i) + "<br>");
}%> 
				</div>
				<div class="form-group">
					<div class="span4">
						<form action="CourseAddAbout" method ="GET">
							<textarea rows="3" style =" width: 515px; margin-left: 10px: " placeholder="About the Course"></textarea>
					
							<P><button type="submit" id="EditAbout" class="btn btn-primary" style="margin-top:5px">Add About</button>
							<input type="hidden" name="courseID" value=<%out.println(course.getCourseID());%> />
						</form>
					</div>
				</div>
			</div>
			
			
			<div class = "row">
				<label for="Prereq" class="col-sm-2 control-label" style= "margin-left: 40px">Prerequisite</label>
			</div>
			<div class="span4 well" >
				<div id= "PrereqContent" > 
					<% 
ArrayList<String> pre = DatabaseOperations.getCoursePrerequisite(course.getCourseID());
for (int i=0; i<pre.size(); i++)
{
	out.println(pre.get(i) + "<br>");
}
%> 
				</div>
				<div class="form-group">
					<div class="span4">
						<form action="CourseAddPrerequisite" method ="GET">
							<textarea rows="3" style =" width: 515px; margin-left: 10px: " placeholder="Add prerequisite"></textarea>
					
							<P><button type="submit" id="AddPrereq" class="btn btn-primary" style="margin-top:5px">Add Prerequisite</button>
							<input type="hidden" name="courseID" value=<%out.println(course.getCourseID());%> />
						</form>
					</div>
				</div>
			</div>
		

						
			
		</div>
  </div>


</body>

</html>




<%-- Dosyanin eski hali:
<!DOCTYPE html>
<html>
<body>
<%@page import="dao.DatabaseOperations"%>
<%@page import="models.CourseBean"%>
<%@page import="dao.ConnectionManager"%>
<%@page import="java.sql.Connection"%>
<%@page import="java.sql.Date"%>
<%@page import="java.sql.SQLException"%>
<%@page import="java.sql.ResultSet"%>
<%@page import="java.sql.Statement"%>
<%@page import="java.util.ArrayList"%>
<%
//there will be changes in this part
CourseBean course = (CourseBean)request.getAttribute("course");
System.out.println("CourseID:");
System.out.println(course.getCourseID());
%>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title><%=course.getCourseName()%></title>
</head>
 
<div id="container" style="width:1000px">
<div id="header" style="background-color:#FFA500;">
<h1 style="margin-bottom:20;"> <% out.println(course.getCourseName());%> </h1></div>

<div id="menu" style="background-color:#FFD700;height:100px;width:100px;float:left;">
<b>CourseID</b><br>
</div>
<div id="content" style="background-color:#EEEEEE;height:100px;width:900px;float:left;">
<% out.println(course.getCourseID());%> </div>

<div id="menu" style="background-color:#14D700;height:200px;width:100px;float:left;">
<b>Objective</b><br>
</div>
<div id="content" style="background-color:#F4CEEE;height:200px;width:400px;float:left;">
<% out.println(course.getCourseObjective());%>
</div>
<div id="change" style="background-color:#FACFEE;height:200px;width:500px;float:left;">
<form action="ChangeCourseObjective" method ="GET">
<textarea id="objective" rows="4" cols="30" name="newObjective"><%out.println(course.getCourseObjective());%></textarea>
<P><input type=submit name="Add New Objective" value="Edit Course Objective">
<input type="hidden" name="courseID" value=<%out.println(course.getCourseID());%> />
</form>
</div>


<div id="menu" style="background-color:2	621CC;height:100px;width:100px;float:left;">
<b>Addition Day</b><br>
</div>
<div id="content" style="background-color:#8EEEEE;height:100px;width:900px;float:left;">
<% out.println(course.getDate());%> </div>


<div id="menu" style="background-color:#FFD700;height:100px;width:100px;float:left;">
<b>Forum URL</b><br>
</div>
<div id="content" style="background-color:#00E5EE;height:100px;width:400px;float:left;">
<% out.println(course.getForumURL());%></div>
<div id="change" style="background-color:#00E5EE;height:100px;width:500px;float:left;">
<form action="ChangeCourseForumURL" method ="GET">
<textarea id="URL" rows="1" cols="50" name="newForumURL"><%out.println(course.getForumURL());%></textarea>
<P><input type=submit name="ChangeForumURL" value="Edit Forum URL">
<input type="hidden" name="courseID" value=<%out.println(course.getCourseID());%> />
</form>
</div>


<div id="menu2" style="background-color:#F2C710;height:100px;width:100px;float:left;">
<b>Language</b><br>
</div>
<div id="content" style="background-color:007FFF;height:100px;width:400px;float:left;">
<% out.println(course.getLanguage());%> 
</div>
<div id="change" style="background-color:007FFF;height:100px;width:500px;float:left;">
<form action="ChangeCourseLanguage" method ="GET">
<textarea id="language" rows="1" cols="50" name="changeLanguage"><%out.println(course.getLanguage());%></textarea>
<P><input type=submit name="ChangeLanguage" value="Edit Language">
<input type="hidden" name="courseID" value=<%out.println(course.getCourseID());%> />
</form>
</div>


<div id="menu" style="background-color:#FFD700;height:300px;width:100px;float:left;">
<b>Rates</b><br>
</div>
<div id="content" style="background-color:#00E5EE;height:300px;width:400px;float:left;">
<% out.println(course.getRate1());%>, <% out.println(course.getRate2());%>, <% out.println(course.getRate3());%>, <% out.println(course.getRate4());%>, <% out.println(course.getRate5());%>
</div>
<form  name="actionForm" action="CourseRate" method ="GET" >
<div id="content" style="background-color:#00E5EE;height:300px;width:500px;float:left;">
<table border="0">
<tr>
<td><label for='rate1' >Clarity of Topics:</label></td>
<td><input type='text' name='rate1' id='rate1'  /></td>
</tr>
<tr>
<td><label for='rate2' >Clarity of Examples:</label></td>
<td><input type='text' name='rate2' id='rate2'  /></td>
</tr>
<tr>
<td><label for='rate3' >Achievements of Objectives:</label></td>
<td><input type='text' name='rate3' id='rate3'  /></td>
</tr>
<tr>
<td><label for='rate4' >Availability of Material:</label></td>
<td><input type='text' name='rate4' id='rate4'  /></td>
</tr>
<tr>
<td><label for='rate5' >Pace of the Course:</label></td>
<td><input type='text' name='rate5' id='rate15'  /></td>
</tr>
<tr>
<td><input type='submit' name='submit' value='Rate Course!' />
</tr>
</table>
<input type="hidden" name="courseID" value=<%out.println(course.getCourseID());%> />
</form>
</div>


<div id="menu" style="background-color:2	621CC;height:100px;width:100px;float:left;">
<b>Average Rate</b><br>
</div>
<div id="content" style="background-color:#8EEEEE;height:100px;width:900px;float:left;">
<% out.println((double)(course.getRate1() + course.getRate2() + course.getRate3() +
course.getRate4() + course.getRate5())/5
);%> </div>


<div id="menu3" style="background-color:#11C710;height:100px;width:100px;float:left;">
<b>Rate Count</b><br>
</div>
<div id="content" style="background-color:#144EEE;height:100px;width:900px;float:left;">
<% out.println(course.getRateCount());%> </div>



<div id="menu2" style="background-color:#F2C710;height:200px;width:100px;float:left;">
<b>Comment</b><br>
</div>
<div id="content" style="background-color:#144EEE;height:200px;width:400px;float:left;">
<% 

ArrayList<ArrayList<String>> comments = DatabaseOperations.getComments(course.getCourseID());
int count = 0;
for (int i=0; i<comments.size(); i++)
{
	ArrayList<String> temp = comments.get(i);
	out.println("<b>" + temp.get(0) + "</b>" +
			": " + temp.get(1) + ", <i>" +  temp.get(2) + " likes.</i>");
				out.println("<br>");
	
}
%> 
</div>
<div id="change" style="background-color:#144EEE;height:200px;width:500px;float:left;">
<form action="CourseMakeComment" method ="GET">
<textarea id="objective" rows="4" cols="30" name="comment"></textarea>
<P><input type=submit name="Add New Objective" value="Comment">
<input type="hidden" name="courseID" value=<%out.println(course.getCourseID());%> />
<input type="hidden" name="studentID" value=<%out.println(session.getAttribute("currentName"));%> />
</form>
</div>



<div id="menu2" style="background-color:#F2C710;height:200px;width:100px;float:left;">
<b>About</b><br>
</div>
<div id="content" style="background-color:007FFF;height:200px;width:400px;float:left;">
<%
	System.out.println();
	ArrayList<String> about = DatabaseOperations.getCourseAbout(course.getCourseID());
for (int i=0; i<about.size(); i++)
{
	out.println(about.get(i) + "<br>");
}
%> 
</div>
<div id="change" style="background-color:007FFF;height:200px;width:500px;float:left;">
<form action="CourseAddAbout" method ="GET">
<textarea id="objective" rows="4" cols="30" name="about"></textarea>
<P><input type=submit name="Add New Objective" value="Add About">
<input type="hidden" name="courseID" value=<%out.println(course.getCourseID());%> />
</form>
</div>



<div id="menu2" style="background-color:#F2C710;height:200px;width:100px;float:left;">
<b>Prerequisite</b><br>
</div>
<div id="content" style="background-color:007FFF;height:200px;width:400px;float:left;">
<% 
ArrayList<String> pre = DatabaseOperations.getCoursePrerequisite(course.getCourseID());
for (int i=0; i<pre.size(); i++)
{
	out.println(pre.get(i) + "<br>");
}
%> 
</div>
<div id="change" style="background-color:007FFF;height:200px;width:500px;float:left;">
<form action="CourseAddPrerequisite" method ="GET">
<textarea id="objective" rows="4" cols="30" name="pre"></textarea>
<P><input type=submit name="Add New Objective" value="Add Prerequisite">
<input type="hidden" name="courseID" value=<%out.println(course.getCourseID());%> />
</form>
</div>



 
</body>
</html>--%>